<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>3.5.3 布尔操作符</title>
    <script>
        console.log(!false);
        console.log(!'blue');
        console.log(!0);
        console.log(!NaN);
        console.log(!'');
        console.log(!12345);
        console.log('===========');

        console.log(!!'blue');
        console.log(!!0);
        console.log(!!NaN);
        console.log(!!'');
        console.log(!!12345);
        console.log('===========');

        console.log(Boolean('非空'));
        console.log(Boolean(''));
        console.log(Boolean(0));
        console.log(Boolean(1));
        console.log(Boolean(-1));
        console.log(Boolean(Number.MAX_VALUE));
        console.log(Boolean(NaN));
        let obj = new Object();
        console.log(Boolean(obj));
        console.log(Boolean(null));
        console.log(Boolean(undefined));
        console.log('=============');

        let message = 'Hello World';
        if (message) {
            console.log('Value is true');
        }
        console.log(Boolean(!'blue'));

        if (!!message) {
            console.log('message: ' + message);
        }

        let obj1 = new Object();
        let obj2 = new Object({test: '测试'});
        let result1 = true && obj2;
        console.log(result1);

        let found = true;
        let result2 = (false && someUndefinedVariable);
        console.log(result2);

        let name;
        console.log(name);
    </script>
</head>
<body>

</body>
</html>